package admin.service;

import admin.repository.AppealRepository;
import common.model.Appeal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AppealService {

    @Autowired
    private AppealRepository appealRepository;

    public void processAppeal(Long id) {
        Appeal appeal = appealRepository.findById(id).orElseThrow(() -> new RuntimeException("Appeal not found"));
        appeal.setProcessed(true);
        appealRepository.save(appeal);
    }

    public void approveAppeal(Long id) {
        Appeal appeal = appealRepository.findById(id).orElseThrow(() -> new RuntimeException("Appeal not found"));
        appeal.setApproved(true);
        appealRepository.save(appeal);
    }
}